/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package medicalassistant;
import java.sql.*;
/**
 *
 * @author Thomas
 */
public class MyHealthPanel extends javax.swing.JPanel {

    /**
     * Creates new form MyHealthPanel
     */
    public MyHealthPanel(int ID, int userType, Connection connect) {
        initComponents();
        try {
            Class.forName("org.sqlite.JDBC");
            conn = connect;
            stat = conn.createStatement();
        } catch(ClassNotFoundException ex) {System.out.println(ex.getMessage());}
        catch(SQLException ex) {System.out.println(ex.getMessage());}
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        myHealthMainPanel = new javax.swing.JPanel();
        myhealthEntries = new javax.swing.JPanel();
        entryDate = new javax.swing.JLabel();
        bloodpressureLabel = new javax.swing.JLabel();
        systolic = new javax.swing.JTextField();
        systolicLabel = new javax.swing.JLabel();
        diastolicLabel = new javax.swing.JLabel();
        diastolic = new javax.swing.JTextField();
        bloodsugarLabel = new javax.swing.JLabel();
        bloodsugar = new javax.swing.JTextField();
        mmoll = new javax.swing.JLabel();
        commentsLabel = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        comments = new javax.swing.JTextArea();
        buttonsPanel = new javax.swing.JPanel();
        submitButton = new javax.swing.JButton();
        cancelButton = new javax.swing.JButton();
        myhealthHeader = new javax.swing.JPanel();
        myhealthUserLabel = new javax.swing.JLabel();
        myhealthDoctorLabel = new javax.swing.JLabel();
        newEntryButton = new javax.swing.JButton();
        myhealthListPanel = new javax.swing.JPanel();
        jScrollPane2 = new javax.swing.JScrollPane();
        myhealthList = new javax.swing.JTable();
        myhealthListHeader = new javax.swing.JLabel();

        setLayout(new java.awt.BorderLayout());

        myHealthMainPanel.setLayout(new java.awt.BorderLayout());

        entryDate.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
        entryDate.setText("12-24-2012");
        entryDate.setToolTipText("");
        entryDate.setName(""); // NOI18N

        bloodpressureLabel.setText("Blood Pressure:");

        systolicLabel.setText("Systolic:");

        diastolicLabel.setText("Diastolic:");

        bloodsugarLabel.setText("Blood Sugar:");

        mmoll.setText("mmol/L");

        commentsLabel.setText("Comments:");

        comments.setColumns(20);
        comments.setRows(5);
        jScrollPane1.setViewportView(comments);

        submitButton.setText("Submit");
        submitButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                submitButtonActionPerformed(evt);
            }
        });
        buttonsPanel.add(submitButton);

        cancelButton.setText("Cancel");
        cancelButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cancelButtonActionPerformed(evt);
            }
        });
        buttonsPanel.add(cancelButton);

        javax.swing.GroupLayout myhealthEntriesLayout = new javax.swing.GroupLayout(myhealthEntries);
        myhealthEntries.setLayout(myhealthEntriesLayout);
        myhealthEntriesLayout.setHorizontalGroup(
            myhealthEntriesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(myhealthEntriesLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(myhealthEntriesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane1)
                    .addGroup(myhealthEntriesLayout.createSequentialGroup()
                        .addGroup(myhealthEntriesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(entryDate)
                            .addGroup(myhealthEntriesLayout.createSequentialGroup()
                                .addGroup(myhealthEntriesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(systolicLabel)
                                    .addComponent(bloodsugarLabel))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(myhealthEntriesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                    .addComponent(bloodsugar, javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(systolic, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGap(18, 18, 18)
                                .addGroup(myhealthEntriesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(myhealthEntriesLayout.createSequentialGroup()
                                        .addComponent(diastolicLabel)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(diastolic, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addComponent(mmoll)))
                            .addComponent(bloodpressureLabel)
                            .addComponent(commentsLabel))
                        .addGap(0, 81, Short.MAX_VALUE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, myhealthEntriesLayout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addComponent(buttonsPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );
        myhealthEntriesLayout.setVerticalGroup(
            myhealthEntriesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(myhealthEntriesLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(entryDate)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(bloodpressureLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(myhealthEntriesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(systolic, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(systolicLabel)
                    .addComponent(diastolicLabel)
                    .addComponent(diastolic, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(myhealthEntriesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(bloodsugarLabel)
                    .addComponent(bloodsugar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(mmoll))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(commentsLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(buttonsPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(151, Short.MAX_VALUE))
        );

        myHealthMainPanel.add(myhealthEntries, java.awt.BorderLayout.CENTER);

        myhealthUserLabel.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
        myhealthUserLabel.setText("[0001] Jane Doe");
        myhealthUserLabel.setToolTipText("");
        myhealthUserLabel.setName(""); // NOI18N

        myhealthDoctorLabel.setText("Patient of John Doe");

        newEntryButton.setText("New Entry");
        newEntryButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                newEntryButtonActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout myhealthHeaderLayout = new javax.swing.GroupLayout(myhealthHeader);
        myhealthHeader.setLayout(myhealthHeaderLayout);
        myhealthHeaderLayout.setHorizontalGroup(
            myhealthHeaderLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(myhealthHeaderLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(myhealthUserLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(myhealthDoctorLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 50, Short.MAX_VALUE)
                .addComponent(newEntryButton)
                .addContainerGap())
        );
        myhealthHeaderLayout.setVerticalGroup(
            myhealthHeaderLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(myhealthHeaderLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(myhealthHeaderLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(myhealthUserLabel)
                    .addComponent(myhealthDoctorLabel))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, myhealthHeaderLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(newEntryButton)
                .addContainerGap())
        );

        myHealthMainPanel.add(myhealthHeader, java.awt.BorderLayout.NORTH);

        add(myHealthMainPanel, java.awt.BorderLayout.CENTER);

        myhealthList.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Date", "Summary"
            }
        ) {
            boolean[] canEdit = new boolean [] {
                false, false
            };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jScrollPane2.setViewportView(myhealthList);

        myhealthListHeader.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
        myhealthListHeader.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        myhealthListHeader.setText("My Health");

        javax.swing.GroupLayout myhealthListPanelLayout = new javax.swing.GroupLayout(myhealthListPanel);
        myhealthListPanel.setLayout(myhealthListPanelLayout);
        myhealthListPanelLayout.setHorizontalGroup(
            myhealthListPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(myhealthListPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(myhealthListPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(myhealthListHeader, javax.swing.GroupLayout.DEFAULT_SIZE, 300, Short.MAX_VALUE)
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        myhealthListPanelLayout.setVerticalGroup(
            myhealthListPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, myhealthListPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(myhealthListHeader)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 412, Short.MAX_VALUE)
                .addContainerGap())
        );

        add(myhealthListPanel, java.awt.BorderLayout.WEST);
    }// </editor-fold>//GEN-END:initComponents

    private void newEntryButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_newEntryButtonActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_newEntryButtonActionPerformed

    private void submitButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_submitButtonActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_submitButtonActionPerformed

    private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelButtonActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_cancelButtonActionPerformed
    // SQLite Variable declaration
    private Connection conn;
    private Statement stat;
    // End of SQLite Variable declaration
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel bloodpressureLabel;
    private javax.swing.JTextField bloodsugar;
    private javax.swing.JLabel bloodsugarLabel;
    private javax.swing.JPanel buttonsPanel;
    private javax.swing.JButton cancelButton;
    private javax.swing.JTextArea comments;
    private javax.swing.JLabel commentsLabel;
    private javax.swing.JTextField diastolic;
    private javax.swing.JLabel diastolicLabel;
    private javax.swing.JLabel entryDate;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JLabel mmoll;
    private javax.swing.JPanel myHealthMainPanel;
    private javax.swing.JLabel myhealthDoctorLabel;
    private javax.swing.JPanel myhealthEntries;
    private javax.swing.JPanel myhealthHeader;
    private javax.swing.JTable myhealthList;
    private javax.swing.JLabel myhealthListHeader;
    private javax.swing.JPanel myhealthListPanel;
    private javax.swing.JLabel myhealthUserLabel;
    private javax.swing.JButton newEntryButton;
    private javax.swing.JButton submitButton;
    private javax.swing.JTextField systolic;
    private javax.swing.JLabel systolicLabel;
    // End of variables declaration//GEN-END:variables
}
